package net.dao.impl;

import java.util.List;

import net.dao.RasgoDao;
import net.model.Rasgo;

import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository(value = "rasgoDao")
public class RasgoDaoImpl implements RasgoDao{
	
	@Autowired
	private SessionFactory sessionFactory;

	@Override
	public List<Rasgo> getAllRasgo() {
		Criteria criteria = sessionFactory.getCurrentSession().createCriteria(
				Rasgo.class);
		return (List<Rasgo>) criteria.list();
	}

	@Override
	public void saveRasgo(Rasgo rasgo) {
		sessionFactory.getCurrentSession().saveOrUpdate(rasgo);
	}

}
